<!-- 录取名单 -->
<template>
	<view class="admissionList">
		<top-page :majorList="majorList" :querySign="info"></top-page>
		<view class="contents">
			<view class="tableBox">
				<!-- <wyb-table ref="table" :first-line-fixed="true" :headers="headers" :contents="tableData" width="100%" /> -->
				<wyb-table :first-line-fixed="true" :height="tableHeight" ref="table" :headers="headers" :contents="tableData" width="100%" />
			</view>
		</view>
		
		<!-- <buoy></buoy> -->
	</view>
</template>

<script>
	import {pageBaseEnrollInfoEnroll} from '@/api/toolbox.js'
	import wybTable from '@/pages/toolbox/components/wyb-table/wyb-table.vue'
	import topPage from "./top-page.vue"
	// import buoy from '@/components/buoy/buoys.vue';
	
	export default {
		components: {
			wybTable,
			topPage
			// buoy
		},
		data() {
			return {
				tableHeight: '500px',
				pages: 1,
				total: 0,
				iStatusBarHeight: 0,
				majorList: {}, //该专业信息
				title: '',
				info: {},
				tableData: [],
				headers: [
					{
						label: '年份',
						key: 'year',
						width: 100
					},
					{
						label: '准考证号',
						key: 'examCardNumber',
						width: 100
					},
					{
						label: '姓名',
						key: 'studentName',
						width: 100
					},
					{
						label: '初试',
						key: 'firstExamGrade',
						width: 100
					},
					{
						label: '复试',
						key: 'retestExamGrade',
						width: 100
					},
					{
						label: '录取',
						key: 'enrollExamGrade',
						width: 100
					},
					{
						label: '是否录取',
						key: 'enrollStr',
						width: 100
					},
					{
						label: '政治分',
						key: 'politics',
						width: 100
					},
					{
						label: '英语分',
						key: 'english',
						width: 100
					},
					{
						label: '专一',
						key: 'major1',
						width: 100
					},
					{
						label: '专二',
						key: 'major2',
						width: 100
					},
					{
						label: '外语测试',
						key: 'englishTest',
						width: 100
					},
					{
						label: '专业复试',
						key: 'majorReset',
						width: 100
					},
					{
						label: '综合面试',
						key: 'viewTotal',
						width: 100
					},
					{
						label: '思想政治考核',
						key: 'politicsCheck',
						width: 100
					},
					{
						label: '学习形式',
						key: 'studyTypeStr',
						width: 100
					},
					{
						label: '录取备注',
						key: 'enrollRemark',
						width: 100
					},
					{
						label: '录取方式',
						key: 'enrollTypeStr',
						width: 100
					},
					{
						label: '是否专项计划',
						key: 'plainDesc',
						width: 100
					},
					{
						label: '是否定向',
						key: 'enrollStyleStr',
						width: 100
					},
					{
						label: '备注',
						key: 'remark',
						width: 100
					},
					{
						label: '第一志愿学校',
						key: 'firstChoiceSchool',
						width: 100
					},
				]
			}
		},
		onLoad(options) {
			this.majorList = JSON.parse(options.majorList);
			this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight + 10;			
			this.info = {...options};
			const { windowHeight } = uni.getSystemInfoSync(); // 获取页面高度
			this.tableHeight = windowHeight-100+'px';
			//是否查看demo
			if(options.isDemo == 1){
				this.info.majorCode = '045115';
				this.info.collegeCode = '005';
				this.info.schoolCode = '10691';
			}
			
			this.getList()
		},
		methods: {
			goback() {
				uni.navigateBack({
					delta: 1
				})
			},
			getList() {
				let params = {
					schoolCode:  this.info.schoolCode,
					collegeCode: this.info.collegeCode,
					majorCode: this.info.majorCode,
					pageNum: this.pages,
					pageSize: 15,
					reasonable: true					
				}
				pageBaseEnrollInfoEnroll(params).then(res=>{
					if(res.code === 100000){
						if(this.pages ==1){
							this.tableData = res.data.rows;
							console.log('this.ta: ',this.tableData);
							this.total = res.data.total;
							return
						}
						this.tableData.push.apply(this.tableData,res.data.rows);	
					}
				})
			},
			
			//底部刷新
			onReachBottom() {
				if(this.tableData.length>=this.total) return;
				this.pages++;
				this.getList();
			}
		},
		
	}
</script>

<style lang="scss" scoped>
	page{
		background: #f2f2f2;
	}
	.contents{
		margin: 30rpx;
	}
	
	.null-data{
		text-align: center;
		img{
			margin: auto
		}
	}
</style>
